package com.chenfan.magic.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @author liuming
 * @date 2021-08-06 15:00
 */
@Data
@Configuration
public class CkDataSourceConfig {

    private String driverClassName;
    private String url;
    private String username;
    private String password;
    private Integer initialSize;
    private Integer maxActive;
    private Integer minIdle;
    private Integer maxWait;

    @Value("${spring.datasource.druid.clickhouse.driver-class-name}")
    public void setDriverClassName(String driverClassName) {
        this.driverClassName = driverClassName;
    }

    @Value("${spring.datasource.druid.clickhouse.url}")
    public void setUrl(String url) {
        this.url = url;
    }

    @Value("${spring.datasource.druid.clickhouse.username}")
    public void setUsername(String username) {
        this.username = username;
    }

    @Value("${spring.datasource.druid.clickhouse.password}")
    public void setPassword(String password) {
        this.password = password;
    }

    @Value("${spring.datasource.druid.clickhouse.initial-size}")
    public void setInitialSize(Integer initialSize) {
        this.initialSize = initialSize;
    }

    @Value("${spring.datasource.druid.clickhouse.max-active}")
    public void setMaxActive(Integer maxActive) {
        this.maxActive = maxActive;
    }

    @Value("${spring.datasource.druid.clickhouse.min-idle}")
    public void setMinIdle(Integer minIdle) {
        this.minIdle = minIdle;
    }

    @Value("${spring.datasource.druid.clickhouse.max-wait}")
    public void setMaxWait(Integer maxWait) {
        this.maxWait = maxWait;
    }
}
